/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.marist.cs.os.g3.vm;

/**
 *
 * @author Intern
 */
public class Drum {

    Track[] tracks;

    public Drum() {
        tracks = new Track[100];
        for (int i = 0; i < 100; i++) {
            tracks[i] = new Track();
        }
    }

    public boolean fillTrack(String string, int i) {
        if (!tracks[i].isEmpty()) {
            return false;
        }
        tracks[i] = new Track(string);
        return true;
    }

    public void freeBlock(int i) {
        tracks[i].setEmpty();
    }

    public boolean isTrackFree(int i) {
        return tracks[i].isEmpty();
    }

    public int firstFreeTrack() {
        for (int i = 0; i < tracks.length; i++) {
            if (tracks[i].isEmpty()) {
                return i;
            }
        }
        return -1;
    }

    public Track getTrack(int i) {
        return tracks[i];
    }
}
